const { AsyncSeriesHook } = require('tapable')

let hook = new AsyncSeriesHook(['name'])

console.time('time')
hook.tapPromise('fn1', (name) => {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            console.log('fn1 ----> ', name);
            resolve()
        }, 1000)
    })
})


hook.tapPromise('fn2', (name) => {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            console.log('fn2 ----> ', name);
            resolve()
        }, 2000)
    })
})



hook.promise('fffff').then(() => {
    console.log('完成');
    console.timeEnd('time')
})